map
A mutable map from keys of type K to values of type V, where K is immutable, and V may be either mutable or immutable. map<K,V> is a subtype of iterable<(K,V)>`. It is implemented as a hash-map, with iteration order determined by the order in which the entries were added.
Since
0.6.0
See also
Constructors
Functions
Get the value associated with the given key in this map.
Get the value associated with the given key in this map.
Generate a textual representation of this iterable.
An optional separator, prefix and postfix can be provided. One can also provide a limit: integer?. If there are more elements in the result than limit, the elements whose indices exceed limit are omitted, and the passed truncated: text is included instead.
Examples:
[1, 2, 3].join_to_text()returns'1, 2, 3'.[1, 2, 3].join_to_text('_')returns'1_2_3'.[1, 2, 3].join_to_text('*', '(', ')')returns'(1*2*3)'.list<T>().join_to_text('!', '(', ')')returns'()'(whereTis a valid type).range(10).join_to_text('', '', '', 5)returns'01234...'.range(10).join_to_text('', '', '', 5, 'more')returns'01234more'.
Where the function even is defined:
function even(x: integer): text {
return if (x % 2 == 0) 'EVEN' else 'ODD';
}Then:
range(10).join_to_text('->', '{', '}', 5, '...', even(*))returns{EVEN->ODD->EVEN->ODD->EVEN->...}.
Returns a new map with the mappings of this map combined with the mappings of the given map.
Where a value exists for a given key in both this and the other map, the returned map has the value of the other map, as opposed to the value in this map (right-biased).
a.put_all_copy(b) is equivalent to a + b, where a and b are both maps.
Examples:
[1: 'a', 2: 'b', 3: 'c'].put_all_copy([1: 'Z', 4: 'd', 5: 'e'])returns[1: 'Z', 2: 'b', 3: 'c', 4: 'd', 5: 'e'][1: 'a', 2: 'b', 3: 'c'].put_all_copy([4: 'd', 5: 'e'])returns[1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e']
Remove an entry from this map.